package com.hutiao.snowhb.actions.huodong;

import java.util.List;

import org.apache.log4j.Logger;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.json.annotations.JSON;

import com.hutiao.snowhb.common.WeixinUtil;
import com.hutiao.snowhb.entities.PhotographerBean;
import com.hutiao.snowhb.entities.PhotoCommentBean;
import com.hutiao.snowhb.entities.WeixinUserInfo;
import com.hutiao.snowhb.service.PhotographerService;
import com.opensymphony.xwork2.ActionSupport;

@Namespace("/huodong")
public class PhotographerDetailAction extends ActionSupport {
	
	private static final long serialVersionUID = 9134703786876385174L;

	private static Logger logger = Logger.getLogger(PhotographerDetailAction.class);
	
	private int photoId;
	
	private String visitorOpenId;
	
	private PhotographerBean photo;
	
	private List<PhotoCommentBean> comments;
	
	private PhotoCommentBean postComment;
	
	private PhotographerService photographerService;
	
	private String result;
	
	@JSON(serialize=false)
	public int getPhotoId() {
		return photoId;
	}
	public void setPhotoId(int photoId) {
		this.photoId = photoId;
	}
	
	@JSON(serialize=false)
	public String getVisitorOpenId() {
		return visitorOpenId;
	}
	public void setVisitorOpenId(String visitorOpenId) {
		this.visitorOpenId = visitorOpenId;
	}
	
	@JSON(serialize=false)
	public PhotographerBean getPhoto() {
		return photo;
	}
	public void setPhoto(PhotographerBean photo) {
		this.photo = photo;
	}
	
	@JSON(serialize=false)
	public PhotographerService getPhotographerService() {
		return photographerService;
	}
	public void setPhotographerService(PhotographerService photographerService) {
		this.photographerService = photographerService;
	}
	
	public String getResult() {
		return result;
	}
	public void setResult(String result) {
		this.result = result;
	}
	
	public List<PhotoCommentBean> getComments() {
		return comments;
	}
	public void setComments(List<PhotoCommentBean> comments) {
		this.comments = comments;
	}
	
	@JSON(serialize=false)
	public PhotoCommentBean getPostComment() {
		return postComment;
	}
	public void setPostComment(PhotoCommentBean postComment) {
		this.postComment = postComment;
	}
	
	
	@Action(value="photographer_detail")
	public String detail() throws Exception {
		
		this.photo = this.photographerService.getPhotoById(this.photoId);
		
		return SUCCESS;
	}
	
	@Action(value="photographer_readComment",results = { @Result(type = "json") })
	public String readComment() throws Exception {
		
		return SUCCESS;
	}
	
	@Action(value="photographer_postComment",results = { @Result(type = "json") })
	public String postComment() throws Exception {
		
		
		return SUCCESS;
	}
	
	@Action(value="photographer_delComment",results = { @Result(type = "json") })
	public String delComment() throws Exception {
		
		
		return SUCCESS;
	}
	
	@Action(value="photographer_like",results = { @Result(type = "json") })
	public String like() throws Exception {
		
		return SUCCESS;
	}
	
	@Action(value="photographer_unlike",results = { @Result(type = "json") })
	public String unlike() throws Exception {
		
		return SUCCESS;
	}
}
